package com.example.Laboratory.Mapper;


import com.example.Laboratory.Entity.Instrument;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface InstrumentMapper {

    //增加设备
    @Insert("INSERT INTO instrument(instrument_name,instrument_type,instrument_quantity,instrument_price,instrument_factory,instrument_time)" +
            "VALUES(#{instrument_name},#{instrument_type},#{instrument_quantity},#{instrument_price},#{instrument_factory},#{instrument_time})")
    int addInstrument (Instrument t);

    //删除设备
    @Delete("DELETE FROM instrument WHERE instrument_id=#{instrument_id}")
    int deleteInstrument (int instrument_id);


    //查找设备全表
    @Select("SELECT * FROM instrument ORDER BY instrument_price DESC")
    List<Instrument> selectInstrumentAll ( );

    //修改设备
    @Update("UPDATE instrument SET instrument_name=#{instrument_name},instrument_type=#{instrument_type},instrument_quantity=#{instrument_quantity},instrument_price=#{instrument_price},instrument_factory=#{instrument_factory},instrument_time=#{instrument_time} WHERE instrument_id=#{instrument_id}")
    int updateInstrument (Instrument i);
}
